package com.fudan.run.action;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import com.fudan.cfg.base.MapUtils;

public class ActionMeta {

	public static Map<String,Object> buildMetadata(String id) {
		Map<String,Object> meta = new HashMap<>();
		String buildTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
		MapUtils.putValue(meta, "task_id", id);
		MapUtils.putValue(meta, "build_time", buildTime);
		List<Map<String,Object>> metadata = new LinkedList<>();
		metadata.add(meta);
		Map<String,Object> metaMap = new  HashMap<>();
		metaMap.put("_meta", metadata);
		return metaMap;
	}
}
